﻿namespace Anley.DomainDrivenDesign.Contract.Application;

/// <summary>
/// 友好异常类
/// </summary>
public class FriendlyException
    : Exception
{
    private static readonly ILogger _logger;

    static FriendlyException()
    {
        _logger = LogManager.GetCurrentClassLogger();
    }

    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="message">消息</param>
    public FriendlyException(
        string message)
        : base(message)
    {
        _logger.Error(message);
    }

    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="message">消息</param>
    /// <param name="ex">异常</param>
    public FriendlyException(
        string message,
        Exception ex)
        : base(message, ex)
    {
        _logger.Error(ex, message);
    }
}